package StudyCode.summary.regularexpressionsmatch;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class StringMatchWithRegularExpression {
	private static String jaText = "this is a test ";
	private static String enText = "The fat cat sat on the mat with a brown rat.";
	private static String enRegEx = "^The \\w+ cat.*";
	private static String jaRegEx = ".*.*";
	private static String jaRegExEscaped = ".*\u6587\u5B57.*";

	public static void main(String[] args) {

		boolean found = false;
		found = enText.matches(enRegEx);
		if (found) {
			System.out.printf("Matches %s.\n", enRegEx);
		}

		found = jaText.matches(jaRegEx);
		if (found) {
			System.out.printf("Matches %s.\n", jaRegEx);
		}

		found = jaText.matches(jaRegExEscaped);
		if (found) {
			System.out.printf("Matches %s.\n", jaRegExEscaped);
		}
	}
}
